.class public Lcom/xingbook/ui/w;
.super Landroid/view/View;

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field public a:Z

.field final synthetic b:Lcom/xingbook/ui/t;

.field private c:I

.field private d:I

.field private e:Ljava/lang/Object;

.field private f:Z

.field private g:I

.field private h:F

.field private i:F

.field private j:F


# direct methods
.method public constructor <init>(Lcom/xingbook/ui/t;Landroid/app/Activity;)V
    .locals 2

    const/4 v1, 0x0

    iput-object p1, p0, Lcom/xingbook/ui/w;->b:Lcom/xingbook/ui/t;

    invoke-virtual {p2}, Landroid/app/Activity;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    invoke-direct {p0, v0}, Landroid/view/View;-><init>(Landroid/content/Context;)V

    iput v1, p0, Lcom/xingbook/ui/w;->c:I

    iput v1, p0, Lcom/xingbook/ui/w;->d:I

    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/xingbook/ui/w;->e:Ljava/lang/Object;

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/xingbook/ui/w;->a:Z

    iput-boolean v1, p0, Lcom/xingbook/ui/w;->f:Z

    iput v1, p0, Lcom/xingbook/ui/w;->g:I

    invoke-static {p2}, Lcom/xingbook/c/n;->f(Landroid/app/Activity;)F

    move-result v0

    iput v0, p0, Lcom/xingbook/ui/w;->j:F

    return-void
.end method

.method private declared-synchronized getNeedMarquee()Z
    .locals 1

    monitor-enter p0

    :try_start_0
    iget-boolean v0, p0, Lcom/xingbook/ui/w;->f:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit p0

    return v0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method private declared-synchronized setNeedMarquee(Z)V
    .locals 2

    monitor-enter p0

    :try_start_0
    iget-boolean v0, p0, Lcom/xingbook/ui/w;->f:Z
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-ne v0, p1, :cond_0

    :goto_0
    monitor-exit p0

    return-void

    :cond_0
    const/4 v0, 0x0

    :try_start_1
    iput v0, p0, Lcom/xingbook/ui/w;->g:I

    if-eqz p1, :cond_1

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/xingbook/ui/w;->f:Z

    new-instance v0, Ljava/lang/Thread;

    invoke-direct {v0, p0}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    invoke-virtual {v0}, Ljava/lang/Thread;->start()V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit p0

    throw v0

    :cond_1
    const/4 v0, 0x0

    :try_start_2
    iput-boolean v0, p0, Lcom/xingbook/ui/w;->f:Z

    iget-object v1, p0, Lcom/xingbook/ui/w;->e:Ljava/lang/Object;

    monitor-enter v1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    :try_start_3
    iget-object v0, p0, Lcom/xingbook/ui/w;->e:Ljava/lang/Object;

    invoke-virtual {v0}, Ljava/lang/Object;->notify()V

    monitor-exit v1

    goto :goto_0

    :catchall_1
    move-exception v0

    monitor-exit v1
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_1

    :try_start_4
    throw v0
    :try_end_4
    .catchall {:try_start_4 .. :try_end_4} :catchall_0
.end method


# virtual methods
.method public a()V
    .locals 1

    const/4 v0, 0x0

    iput v0, p0, Lcom/xingbook/ui/w;->g:I

    const/4 v0, 0x0

    iput v0, p0, Lcom/xingbook/ui/w;->h:F

    return-void
.end method

.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 6

    const/4 v5, 0x1

    const/high16 v4, 0x4000

    const/4 v0, 0x0

    iget-object v1, p0, Lcom/xingbook/ui/w;->b:Lcom/xingbook/ui/t;

    iget-object v1, v1, Lcom/xingbook/ui/t;->c:Ljava/lang/String;

    if-eqz v1, :cond_0

    const-string v1, ""

    iget-object v2, p0, Lcom/xingbook/ui/w;->b:Lcom/xingbook/ui/t;

    iget-object v2, v2, Lcom/xingbook/ui/t;->c:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    :cond_0
    :goto_0
    return-void

    :cond_1
    invoke-static {}, Lcom/xingbook/ui/t;->a()Landroid/graphics/Paint;

    move-result-object v1

    invoke-virtual {v1, v5}, Landroid/graphics/Paint;->setFlags(I)V

    invoke-static {}, Lcom/xingbook/ui/t;->a()Landroid/graphics/Paint;

    move-result-object v1

    const/4 v2, -0x1

    invoke-virtual {v1, v2}, Landroid/graphics/Paint;->setColor(I)V

    invoke-static {}, Lcom/xingbook/ui/t;->a()Landroid/graphics/Paint;

    move-result-object v1

    sget-object v2, Landroid/graphics/Paint$Align;->LEFT:Landroid/graphics/Paint$Align;

    invoke-virtual {v1, v2}, Landroid/graphics/Paint;->setTextAlign(Landroid/graphics/Paint$Align;)V

    invoke-static {}, Lcom/xingbook/ui/t;->a()Landroid/graphics/Paint;

    move-result-object v1

    const/high16 v2, 0x4240

    iget v3, p0, Lcom/xingbook/ui/w;->j:F

    mul-float/2addr v2, v3

    invoke-virtual {v1, v2}, Landroid/graphics/Paint;->setTextSize(F)V

    iget-object v1, p0, Lcom/xingbook/ui/w;->b:Lcom/xingbook/ui/t;

    iget-object v1, v1, Lcom/xingbook/ui/t;->c:Ljava/lang/String;

    if-eqz v1, :cond_0

    const-string v1, ""

    iget-object v2, p0, Lcom/xingbook/ui/w;->b:Lcom/xingbook/ui/t;

    iget-object v2, v2, Lcom/xingbook/ui/t;->c:Ljava/lang/String;

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_0

    invoke-static {}, Lcom/xingbook/ui/t;->a()Landroid/graphics/Paint;

    move-result-object v1

    iget-object v2, p0, Lcom/xingbook/ui/w;->b:Lcom/xingbook/ui/t;

    iget-object v2, v2, Lcom/xingbook/ui/t;->c:Ljava/lang/String;

    invoke-virtual {v1, v2}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v1

    iput v1, p0, Lcom/xingbook/ui/w;->h:F

    invoke-static {}, Lcom/xingbook/ui/t;->a()Landroid/graphics/Paint;

    move-result-object v1

    invoke-virtual {v1}, Landroid/graphics/Paint;->getFontMetrics()Landroid/graphics/Paint$FontMetrics;

    move-result-object v1

    iget v2, p0, Lcom/xingbook/ui/w;->c:I

    int-to-float v2, v2

    iget v3, v1, Landroid/graphics/Paint$FontMetrics;->descent:F

    sub-float/2addr v2, v3

    iget v1, v1, Landroid/graphics/Paint$FontMetrics;->ascent:F

    sub-float v1, v2, v1

    div-float v2, v1, v4

    iget v1, p0, Lcom/xingbook/ui/w;->d:I

    int-to-float v1, v1

    iget v3, p0, Lcom/xingbook/ui/w;->h:F

    sub-float/2addr v1, v3

    div-float/2addr v1, v4

    cmpg-float v3, v1, v0

    if-gez v3, :cond_3

    :goto_1
    iget v1, p0, Lcom/xingbook/ui/w;->h:F

    iget v3, p0, Lcom/xingbook/ui/w;->d:I

    int-to-float v3, v3

    cmpl-float v1, v1, v3

    if-lez v1, :cond_2

    iget-boolean v1, p0, Lcom/xingbook/ui/w;->a:Z

    if-eqz v1, :cond_2

    invoke-static {}, Lcom/xingbook/ui/t;->a()Landroid/graphics/Paint;

    move-result-object v0

    const-string v1, "        "

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v0

    iput v0, p0, Lcom/xingbook/ui/w;->i:F

    new-instance v0, Ljava/lang/StringBuilder;

    iget-object v1, p0, Lcom/xingbook/ui/w;->b:Lcom/xingbook/ui/t;

    iget-object v1, v1, Lcom/xingbook/ui/t;->c:Ljava/lang/String;

    invoke-static {v1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v1, "        "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v1, p0, Lcom/xingbook/ui/w;->b:Lcom/xingbook/ui/t;

    iget-object v1, v1, Lcom/xingbook/ui/t;->c:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    iget v1, p0, Lcom/xingbook/ui/w;->g:I

    int-to-float v1, v1

    invoke-static {}, Lcom/xingbook/ui/t;->a()Landroid/graphics/Paint;

    move-result-object v3

    invoke-virtual {p1, v0, v1, v2, v3}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    invoke-direct {p0, v5}, Lcom/xingbook/ui/w;->setNeedMarquee(Z)V

    goto/16 :goto_0

    :cond_2
    const/4 v1, 0x0

    invoke-direct {p0, v1}, Lcom/xingbook/ui/w;->setNeedMarquee(Z)V

    iget-object v1, p0, Lcom/xingbook/ui/w;->b:Lcom/xingbook/ui/t;

    iget-object v1, v1, Lcom/xingbook/ui/t;->c:Ljava/lang/String;

    invoke-static {}, Lcom/xingbook/ui/t;->a()Landroid/graphics/Paint;

    move-result-object v3

    invoke-virtual {p1, v1, v0, v2, v3}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    goto/16 :goto_0

    :cond_3
    move v0, v1

    goto :goto_1
.end method

.method protected onLayout(ZIIII)V
    .locals 1

    sub-int v0, p4, p2

    iput v0, p0, Lcom/xingbook/ui/w;->d:I

    sub-int v0, p5, p3

    iput v0, p0, Lcom/xingbook/ui/w;->c:I

    invoke-super/range {p0 .. p5}, Landroid/view/View;->onLayout(ZIIII)V

    return-void
.end method

.method public run()V
    .locals 4

    :try_start_0
    iget-object v1, p0, Lcom/xingbook/ui/w;->e:Ljava/lang/Object;

    monitor-enter v1
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    :try_start_1
    iget-object v0, p0, Lcom/xingbook/ui/w;->e:Ljava/lang/Object;

    const-wide/16 v2, 0x7d0

    invoke-virtual {v0, v2, v3}, Ljava/lang/Object;->wait(J)V

    monitor-exit v1
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    :goto_0
    invoke-direct {p0}, Lcom/xingbook/ui/w;->getNeedMarquee()Z

    move-result v0

    if-nez v0, :cond_0

    return-void

    :catchall_0
    move-exception v0

    :try_start_2
    monitor-exit v1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    :try_start_3
    throw v0
    :try_end_3
    .catch Ljava/lang/InterruptedException; {:try_start_3 .. :try_end_3} :catch_0

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/InterruptedException;->printStackTrace()V

    goto :goto_0

    :cond_0
    :try_start_4
    iget v0, p0, Lcom/xingbook/ui/w;->g:I

    if-nez v0, :cond_1

    invoke-virtual {p0}, Lcom/xingbook/ui/w;->postInvalidate()V

    iget v0, p0, Lcom/xingbook/ui/w;->g:I

    add-int/lit8 v0, v0, -0x1

    iput v0, p0, Lcom/xingbook/ui/w;->g:I

    iget-object v1, p0, Lcom/xingbook/ui/w;->e:Ljava/lang/Object;

    monitor-enter v1
    :try_end_4
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_4} :catch_1

    :try_start_5
    iget-object v0, p0, Lcom/xingbook/ui/w;->e:Ljava/lang/Object;

    const-wide/16 v2, 0x3e8

    invoke-virtual {v0, v2, v3}, Ljava/lang/Object;->wait(J)V

    monitor-exit v1

    goto :goto_0

    :catchall_1
    move-exception v0

    monitor-exit v1
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_1

    :try_start_6
    throw v0

    :catch_1
    move-exception v0

    goto :goto_0

    :cond_1
    invoke-virtual {p0}, Lcom/xingbook/ui/w;->postInvalidate()V

    iget v0, p0, Lcom/xingbook/ui/w;->g:I

    add-int/lit8 v0, v0, -0x1

    iput v0, p0, Lcom/xingbook/ui/w;->g:I

    iget v0, p0, Lcom/xingbook/ui/w;->g:I

    invoke-static {v0}, Ljava/lang/Math;->abs(I)I

    move-result v0

    int-to-float v0, v0

    iget v1, p0, Lcom/xingbook/ui/w;->h:F

    iget v2, p0, Lcom/xingbook/ui/w;->i:F

    add-float/2addr v1, v2

    cmpl-float v0, v0, v1

    if-ltz v0, :cond_2

    const/4 v0, 0x0

    iput v0, p0, Lcom/xingbook/ui/w;->g:I

    :cond_2
    iget-object v1, p0, Lcom/xingbook/ui/w;->e:Ljava/lang/Object;

    monitor-enter v1
    :try_end_6
    .catch Ljava/lang/Exception; {:try_start_6 .. :try_end_6} :catch_1

    :try_start_7
    iget-object v0, p0, Lcom/xingbook/ui/w;->e:Ljava/lang/Object;

    const-wide/16 v2, 0x14

    invoke-virtual {v0, v2, v3}, Ljava/lang/Object;->wait(J)V

    monitor-exit v1

    goto :goto_0

    :catchall_2
    move-exception v0

    monitor-exit v1
    :try_end_7
    .catchall {:try_start_7 .. :try_end_7} :catchall_2

    :try_start_8
    throw v0
    :try_end_8
    .catch Ljava/lang/Exception; {:try_start_8 .. :try_end_8} :catch_1
.end method
